package com.swind.fast.common.interceptor;

import com.swind.fast.common.constant.CommonConstant;
import com.swind.fast.common.context.BaseContextHandler;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class UserAppCodeInterceptor extends HandlerInterceptorAdapter {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

        // HandlerMethod handlerMethod = null;

        // if (handler instanceof HandlerMethod) {
        //     handlerMethod = (HandlerMethod) handler;
        // }

        // String appCode = request.getHeader(CommonConstant.FRONT_APP_CODE);

        // log.info("UserAppCodeInterceptor");

        // BaseContextHandler.setAppCode(appCode);
        return super.preHandle(request, response, handler);
    }

}
